1. Technology Field
The present invention relates to a flash memory controller having flash memory testing functions and a flash memory testing method.
2. Description of Related Art
The growth of digital cameras, mobile phones, and MP3 players has been rapid in recent years. Consequently, the consumers' demand for storage media has increased tremendously. Flash memory has the characteristics of data non-volatility, low power consumption, compact size, and non-mechanical structure. Hence, flash memory is adapted for portable appliances, especially portable products powered by batteries. A solid state drive (SSD) is a storage apparatus adopting NAND flash memory as storage medium.
The flash memory chip of the flash memory storage apparatus includes one or a plurality of flash memory die(s) according to the volume designed. Moreover, the flash memory dies are divided into a plurality of physical blocks for data storage. Generally, after the flash memory storage apparatus has been manufactured, the vendor performs a reading and writing test to the physical blocks of the flash memory storage apparatus to ensure the quality of the flash memory storage apparatus.
When performing the reading and writing test to the flash memory storage apparatus, in the conventional method the flash memory storage apparatus is connected to a host system (e.g. a computer) installed with a testing software. Then, the testing software is performed to write a testing datum in the flash memory storage apparatus and read the testing datum from the flash memory storage apparatus for testing whether the flash memory chip of the flash memory storage apparatus is able to store data normally.
In general, the physical blocks are logically grouped into a system area, a data area, a spare area, and a replacement area by the flash memory controller of the flash memory storage apparatus. The physical blocks in the system area are configured to store important relevant information of the flash memory storage apparatus. On the other hand, the physical blocks in the replacement area are configured to replace the damaged physical blocks in the data area or the spare area. Therefore, in a general access state, the host system cannot access the physical blocks in the system area and the replacement area. The physical blocks in the data area are used for storing valid data written by write commands, and the physical blocks in the spare area are used for substituting the physical blocks in the data area when the write commands are executed. Specifically, when the flash memory storage apparatus receives a write command from the host system to write data into the physical blocks of the data area, the flash memory controller of the flash memory storage apparatus first selects one physical block from the spare area, and then copies the valid old data originally stored in the physical block to be updated in the data area together with the new data to be written into the physical block selected from the spare area. Further, the physical block written with the new data is logically linked to the data area, and the original physical block to be updated in the data area is erased and logically linked to the spare area. To enable the host system to properly access the physical blocks that store data in an alternate manner, the flash memory storage apparatus provides logical blocks to the host system. That is, the flash memory controller of the flash memory storage system records and updates the relationship between the logical blocks and the physical blocks of the data area in a logical address-physical address mapping table to reflect the alternation of the physical blocks. Accordingly, the host system is only required to perform writing to the logical blocks provided and the flash memory controller of the flash memory storage apparatus would read data from or write data into the physical blocks corresponding to the logical address-physical address mapping table.
Due to the operational characteristics of the flash memory storage apparatus aforementioned, the reading and writing test performed by the testing software of the host system to the flash memory storage apparatus cannot ensure all of the physical blocks have been tested.
Furthermore, the flash memory dies in the flash memory chip of the flash memory storage apparatus are managed by the flash memory controller in the flash memory storage system. Therefore, when the reading and writing test is performed to the flash memory storage apparatus, the testing software in the host system must write the testing data according to the relevant specification of the flash memory controller and cannot synchronously execute the writing operation to all of the flash memory dies in the flash memory storage apparatus. Consequently, when the flash memory chip, which is to be tested, in the flash memory storage apparatus is assembled by a plurality of flash memory dies, the conventional testing method requires a lot of time to complete the writing and reading of all of the flash memory dies.